
{extend name="layout:base" /}{block name="content"}
 <?php
$global=isSupperManagerForSession();
 ?>
 

	<!-- Setup examples on this page -->
	<script type="text/javascript">
		$(function(){

			$('.tipbasic').poshytip();
		

		});
	</script>
 
<link rel="stylesheet" type="text/css" href="/static/My97DatePicker/skin/WdatePicker.css" />
     <script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>
      
      <section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
         <span  data-url="/admin/my/bmlists"  onclick="ContentLoadGo('/admin/my/bmlists')">部门资产</span></div>
      </section>
      <section style="margin-top:10px;margin-left:auto;margin-right:auto;">
      <select name="ser_key" id="ser_key" class="select" >
       <option value="dveid" <?php if($request['ser_key']=="dveid"){echo 'selected';} ?>>资产编号</option>
       <option value="dvename" <?php if($request['ser_key']=="dvename"){echo 'selected';} ?>>资产名称</option>
       <option value="brand" <?php if($request['ser_key']=="brand"){echo 'selected';} ?>>品牌</option>
       <option value="sn" <?php if($request['ser_key']=="sn"){echo 'selected';} ?>>设备生产序号</option>
       <option value="model" <?php if($request['ser_key']=="model"){echo 'selected';} ?>>型号</option>
       <option value="mac" <?php if($request['ser_key']=="mac"){echo 'selected';} ?>>MAC</option>
       <option value="ip" <?php if($request['ser_key']=="ip"){echo 'selected';} ?>>IP</option>
       <option value="uid_name" <?php if($request['ser_key']=="uid_name"){echo 'selected';} ?>>资产责任人姓名</option>
       <option value="uid_name1" <?php if($request['ser_key']=="uid_name1"){echo 'selected';} ?>>资产责任人账号</option>
      </select>
      <input type="text" class="textbox" name="ser_val" id="ser_val" value="<?php echo $request['ser_val']; ?>" placeholder=""/>
       <select name="firstType" id="firstType" class="select firstTypeR">
	       <option value="">--一级分类--</option>
	       <?php
	       
	       foreach($FirstDepList as $key=>$val)
	   		{
	   		?>
	        <option value="<?php echo $val['id']; ?>" <?php if($val['id']==$request['firstType']){ echo 'selected';} ?> ><?php echo $val['dname'] ?></option>
		   <?php
	       }
       		?>
          </select>
          <select name="secondType" id="secondType" class="select secondTypeR">
	       <option value="">--二级分类--</option>
	       <?php
	       foreach($SecondDepList as $key=>$val)
	   		{
	   		?>
	        <option value="<?php echo $val['id']; ?>" <?php if($val['id']==$request['secondType']){ echo 'selected';} ?> ><?php echo $val['dname'] ?></option>
		   <?php
	       }
       		?>
          </select>
          
        <select name="stat" id="stat" class="select">
	       <option value="">--状态--</option>
	 
	        <option value="0" <?php if($request['stat']=='0'){ echo 'selected';} ?> >正常</option>
	        <option value="1" <?php if($request['stat']=='1'){ echo 'selected';} ?> >库存</option>
	        <option value="2" <?php if($request['stat']=='2'){ echo 'selected';} ?> >外借</option>
	        <option value="3" <?php if($request['stat']=='3'){ echo 'selected';} ?> >报废</option>
	        <option value="4" <?php if($request['stat']=='4'){ echo 'selected';} ?> >报修</option>
		  
          </select>
          
          <input name="starttime"  id="starttime" class="Wdate textbox" placeholder="入库时间"  onfocus="WdatePicker({lang:'zh-cn'})" value="<?php echo $request['starttime']; ?>" size="12"  type="text" style="padding: 0 5px;font-size: 12px;border: 1px #139667 solid;vertical-align: middle;" >
          -
          <input name="endtime" id="endtime" class="Wdate textbox" placeholder="入库时间"  onfocus="WdatePicker({lang:'zh-cn'})" value="<?php echo $request['endtime']; ?>" size="12" type="text" style="padding: 0 5px;font-size: 12px;border: 1px #139667 solid;vertical-align: middle;" >
          
          
          
         不显示报废设备 <input type="radio" name="is_show" class="is_show" value="1" <?php if($request['is_show']==1 || $request['is_show']==''){echo 'checked';} ?>>
  
   
     
      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />
      
      <br style="clear:both;width:0px;height:0px;">
     </section>
 
       
   
<table class="table" style="margin-top:10px;">

<tr>

<th>资产名称</th>
<th>资产编号</th>
<th>分类</th>
<th>责任人</th>
<th>网络设备</th>
<th>属性</th>
<th>状态</th>
<th>操作</th>
</tr>

<?php 
foreach($lists['data'] as $key=>$val)
{
?>
<tr data-id="<?php echo $val['id']; ?>">


<td style="text-align:center;line-height:30px;width:120px;" >
<span class="tipbasic" title="<?php echo $val['dvename']; ?>">
<?php
if($val['dvename'])
{
  $tlen =mb_strlen($val['dvename']);
  if($tlen>8)
  {
     echo mb_substr($val['dvename'],0,7,'utf-8');
  }
  else
  {
		echo $val['dvename'];
	}
 
}
 
 ?>
 </span></td>
<td style="text-align:center;line-height:30px;width:150px;"><?php echo $val['dveid'];?></td>
<td style="text-align:center;line-height:30px;width:80px;"><?php 
  
  if(!empty($SecondDepList[$val['type']]))
	{
      	echo '['.$SecondDepList[$val['type']]['dname']."]";
   }
   else
   {
        if($val['first_type'])
		{
		echo "[".$FirstDepList[$val['first_type']]['dname']."]";
		}
   }
 
 ?></td>
 <td style="width:120px;">
 <?php echo "[".$val['useUser']['nickname']."]";?>
 <br>
<?php 
 
  if(!empty($userDepList[$val['useUser']['depid']]))
   {
      echo '['.$userDepList[$val['useUser']['depid']]['depname']."]";
   }
   else
	{
 echo "[".$userDepList[$val['useUser']['first_depid']]['depname']."]";
	}
  
 
 ?>


</td>

<td style="width:60px;"><?php 
if($val['network']=='0')
{
 echo '否';
}else
{
  echo '是';


}


?></td>
<td style="width:120px;">
<?php
if($val['network']!='0')
{
 echo "[".$val['ip']."]<br>";
  echo "[".$val['mac']."]";
}
?>
</td>
<td style="width:60px;"><?php
//0正常 1库存 2外借 3报废  4报修
  if($val['stat']==0)
	{
      echo "正常";
    }
    else if($val['stat']==1)
	{
		echo "库存";
    }else if($val['stat']==2)
	{
		echo "外借";
    }else if($val['stat']==3)
	{
		echo "报废";
    }else if($val['stat']==4)
	{
		echo "保修";
    }
 
 ?></td>




<td style="text-align:right;width:60px;">

 <?php
	    if( ( in_array(13001,$ruleLists) || $global==1) )
		{
    	?>
<input type="button" power="13001" value="详情" class="link_btn info"/>
	<?php
      }
	  ?>	
	
</td>
</tr>
      <?php
      }
	  ?>
</table>
{include file="../application/admin/view/layout/page_tpl_new.html" /}
      <script type="text/javascript">
      
      function myResearch(){
		   var url="/admin/my/bmlists";
		   var ser_key =$("#ser_key").val();
		   var ser_val =$("#ser_val").val();
		  
		   var firstType =$("#firstType").val();
		   var secondType =$("#secondType").val();
		   var stat =$("#stat").val();
		   var starttime =$("#starttime").val();
		   var endtime =$("#endtime").val();
 if(starttime!="" && endtime=="")
       {
          ErrTiShi("请选择结束日期");return false;
       }
       if(starttime=="" && endtime!="")
       {
          ErrTiShi("请选择开始日期");return false;
       }
		   //
		   var is_show=$('input[name="is_show"]:checked').val();
		   if(is_show==1)
		   {
			   is_show=1;
		   }
		   else
		   {
			   is_show=0;
		   }
		
		   var page=$("#cpage").val();
		   var param={
				   ser_key:ser_key, 
				   ser_val:ser_val, 
				   firstType:firstType,
				   secondType:secondType, 
				   stat:stat, 
				   starttime:starttime, 
				   endtime:endtime, 
				   is_show:is_show,
				   page:page
		   };
		   ContentLoadGo(url,param);
	   }
     
      
           $(function(){
        	   <?php
        			   if($request['is_show']==1 || $request['is_show']==''){
        	   ?>
        	        	   var tflag=0;
        	   <?php
        		       }
        			   else
        				   {
        				   ?>
        				   var tflag=1;
        				   <?php
        				   }
        	   ?>

        	   $(".is_show").click(function(){
        		   
        		   if(tflag==0)
        		   {
        			   tflag=1;
        			}
        		   else
        			{
        			   tflag=0;
        			}
        		   if(tflag==0)
        		   {
        			   $(".is_show").attr("checked","checked");
        		   }
        		   else
        			   {
        			   $(".is_show").removeAttr("checked");
        			   }
        		  
                    
        		  
        		   
        		   
        		  
        	   });
        	   //设置搜索栏
        	   $(".research").click(function(){
        		   var page =$(this).attr("page");
        		   $("#cpage").val(page);
        		   myResearch();
        		   
        	   });
        	   
        
        	   
        	   //删除项
        	   $('.del').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/delData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要删除吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   
            				   $(that).parent().parent().remove();
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   
        	 //启用
        	   $('.qy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/qyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要启用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("禁用");
            				  
            				 
            				  $(that).parent().parent().find(".dataStat").html("正常");
            				   $(that).removeClass("qy");
            				   $(that).addClass("jy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	 
        	   //禁用
        	   $('.jy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/jyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要禁用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("启用");
            				   
            				   $(that).parent().parent().find(".dataStat").html("禁用");
            				   $(that).removeClass("jy");
            				   $(that).addClass("qy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   
        	   $(".edit").unbind();
        	   //编辑项
        	   $(".edit").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/editData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   $(".baoxiu").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/baoxiu";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   
        	   
        	   $(".info").click(function(){
        		   var that =this;
        		   var url="/admin/my/bminfoData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		  // MyContentLoad(url,param);
        			ContentGet(url,param)	 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   
        	   

        	   $(".resetPwd").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/resetPwd";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   $(".add").unbind();
        	   
        	   //编辑项
        	   $(".add").click(function(){
        		   
        		   var that =this;
        		   var url="/admin/devlist/addData";
        		   var param={};
        		   MyContentLoad(url,param);
        			 //弹出：确认按钮
        			
        	   });
        	   //导航
        	   $(".topBannerItem").click(function(){
        		   
        		   var attArr = $(this).attr();
            	   goToSelfLink(attArr);
            	   
        			
        	   });
        	   
        	  
        	   
  			   //全选
  		
  				$("#all").click(function(){   
			    	if(this.checked){   
			        	$(".checkBoxInput").attr("checked", true);  
			        	$(".checkBoxInput").prop("checked", true);  
			    	}else{   
						$(".checkBoxInput").attr("checked", false);
						$(".checkBoxInput").prop("checked", false);
			    	}   
			    	var se=getAllSelectItem();
			    	//console.log(se);
			 	}); 
  			   
  			   
  				 $(".firstTypeR").change(function(){
    				   
    				   var url="/admin/devlist/selectTypeChange";
    		   		    var id=$(this).val();
    		   		   
    		   		    var param={
    		   				   id:id
    		   				   
    		   		    };
    				   AjaxRequest(url,param,function(data){
    		  			   if(data.err==0)
    		  			   {
    		  				   var html='<option value="">--选择--</option>';
    		  				   $.each(data.data,function(i,v){
    		  					 html +='<option value="'+v.id+'">'+v.dname+'</option>'
    		  				   })
    		  				   $(".secondTypeR").html(html);
    		  			   }
    		  			   else
    		  			   {
    		  				   ErrTiShi("操作失败");
    		  			   }
    		  		   	});
    				   
    			   });
  				 
  				 
  				$('.tipbasic').poshytip();
  			
           });
           
	  </script>
	  
	    {/block}
   